#https://www.baidu.com/baidu?tn=monline_3_dg&ie=utf-8&wd=%E5%91%A8%E6%9D%B0%E4%BC%A6
import urllib.request
 # 需求 获取 https://www.baidu.com/baidu?tn=monline_3_dg&ie=utf-8&wd=周杰伦的源码
url = 'https://www.baidu.com/baidu?tn=monline_3_dg&ie=utf-8&wd=%E5%91%A8%E6%9D%B0%E4%BC%A6'
headers = {'User-Agent':
               'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0'}
name = urllib.parse.quote('周杰伦')
url = url+name
#请求对象的定制
request = urllib.request.Request(url=url,headers=headers)

 #模拟浏览器向服务器发送请求
response = urllib.request.urlopen(request)

#获取相应内容
content = response.read().decode('utf-8')

print(content)